package cn.edu.neusoft.model.bean;

import cn.edu.neusoft.model.event.eventSubcribe.ReceiveCarIOMsg;
import lombok.Data;

import java.lang.reflect.Field;

@Data
public class Entrance {
    private String carWayCode;
    private String devId;
    private String parkingLotCode;
    private String parkingLot;
    private String sluiceOrgCode;
    private int carDirect;
    private String devChnId;
    private String carNum;
    private int carNumColor;
    private String devName;
    private String carImgUrl;
    private int carColor;
    private String carDirectStr;
    private String carNumPic;
    private int carInnerCategory;
    private String devChnName;
    private long id;
    private String capTime;
    private int carLicensePlateTypeL;

    public Entrance(ReceiveCarIOMsg a) throws IllegalAccessException {
        Field[] fieldsA = a.getClass().getDeclaredFields();
        Field[] fieldsB = this.getClass().getDeclaredFields();

        for (Field fieldA : fieldsA) {
            fieldA.setAccessible(true);
            for (Field fieldB : fieldsB) {
                fieldB.setAccessible(true);
                if (fieldA.getName().equals(fieldB.getName()) && fieldA.getType().equals(fieldB.getType())) {
                    fieldB.set(this, fieldA.get(a));
                }
            }
        }
    }
}
